import { request } from '@ruifox-cms/utils'

// 获取流程组
export function getFlowGroupList(params) {
    return request({
        url: '/workflow/group/selectList',
        method: 'get',
        params
    })
}
// 添加流程组
export function insertGroup(data) {
    return request({
        url: '/workflow/group/create',
        method: 'post',
        data
    })
}
// 修改流程组
export function updateGroup(data) {
    return request({
        url: '/workflow/group/update',
        method: 'post',
        data
    })
}
// 删除流程组
export function deleteGroup(data) {
    return request({
        url: '/workflow/group/delete',
        method: 'post',
        data
    })
}
// 设置工作流
export function createBpmn(data) {
    return request({
        url: '/workflow/bpmn/create',
        method: 'post',
        data
    })
}
// 工作流名称重复检测
export function checkName(params) {
    return request({
        url: '/workflow/bpmn/checkNameInPeerGroup',
        method: 'get',
        params
    })
}
// 部署工作流
export function createDeployment(data) {
    return request({
        url: '/workflow/processDefinition/createDeployment',
        method: 'post',
        data
    })
}
// 挂起、激活工作流
export function activeFlow(data) {
    return request({
        url: '/workflow/processDefinition/active',
        method: 'post',
        data
    })
}
// 获取工作流详情
export function getFlowDetail(params) {
    return request({
        url: '/workflow/bpmn/selectById',
        method: 'get',
        params
    })
}
// 删除工作流
export function deleteFlow(data) {
    return request({
        url: '/workflow/bpmn/delete',
        method: 'post',
        data
    })
}
// 批量删除工作流
export function deleteFlowList(data) {
    return request({
        url: '/workflow/bpmn/deleteList',
        method: 'post',
        data
    })
}
// 获取流程列表
export function getFlowList(params) {
    return request({
        url: '/workflow/bpmn/getBpmnListByGroupIdAndName',
        method: 'get',
        params
    })
}

// 审批
export function processTaskAudit(data) {
    return request({
        url: '/workflow/processTask/audit',
        method: 'post',
        data
    })
}

// 获取流程记录
export function getProcessStatus(params) {
    return request({
        url: '/workflow/processInstance/getProcessStatus',
        method: 'get',
        params
    })
}

// 获取用户审核任务
export function getTaskByUserId(params) {
    return request({
        url: '/workflow/processTask/toBeReviewedTasksByUserId',
        method: 'get',
        params
    })
}
